{% extends "personal_center/base.html" %}
{% load set_val %}
{% load state_display %}
{% block page_link %}
    <link rel="stylesheet" href="../../static/system_setup/css/style.css">
    <link rel="stylesheet" href="../../static/personnel/TimeSelector/skin/jedate.css">
    <link rel="stylesheet" href="../../static/public_file/css/DepartmentSelection.css">
{% endblock %}

{% block style %}
    <style>
        .add_class {
            background: #1E90FF;
        }
        .jeinput_1 {
            border: none;
        }
        .shade {
            position: fixed;top: 0;left: 0;right: 0;bottom: 0;background-color: rgba(36, 36, 36, 0.5);display: none;z-index: 10000;
        }
        #save_from {
            width: 300px;height: 40px;background: #F5F5F5;display: inline-block;line-height: 40px;text-align: center;cursor: pointer;margin-top: 5px;letter-spacing: 15px;
        }
        #save_from:hover {
            background: #cfcfcf;
        }
        #submit_from {
            width: 300px;height: 40px;background: #2db7f5;color: white;display: inline-block;line-height: 40px;text-align: center;cursor: pointer;margin-top: 5px;letter-spacing: 15px;
        }
        #submit_from:hover {
            background: #0c6fd9;
        }
        #cancellation {
            width: 150px;height: 35px;border: #f7f7f7 solid 1px;background: #f7f7f7;text-align: center;line-height: 35px;
        }
        #cancellation:hover {
            background: #cecece;
        }
        #acknowledge {
            width: 150px;height: 35px;border: #2db7f5 solid 1px;background: #2db7f5;margin-left: 10px;color: white;text-align: center;line-height: 35px;
        }
        #acknowledge:hover {
            background: #0c6fd9;
        }
        #review-model {
            width: 600px;height: 400px;background: #F5F5F5;position: absolute;border: #dfdfdf solid 1px;margin: auto;border-radius: 3px;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 10100;font-size: 0;
        }
        #review-title {
            display: flex;justify-content: space-between;box-sizing: border-box;padding: 0 10px;height: 40px;color: #0b0b0b;cursor: move;width: 100%;background: #f4f7fa;border-top-left-radius: 5px;border-top-right-radius: 5px;
        }
        #processed1 div {
            padding-left: 2%;
        }
        #processed1 div:hover {
            background: #cfcfcf;
        }
        #close1 {
            right: -5px;top: -5px;position: absolute;
        }
    </style>
{% endblock %}

{% block right_content %}
    <div style="width: 100%; height: 100%; background: white;position:relative;">
        <div id="self_check" style="background: white; width: 100%;height: 94%;overflow: auto;">
            <div style="width: 60%;margin-left: 20%;margin-bottom: 100px;">
                <table style="border-collapse: collapse;width: 100%;margin-top: 30px;">
                    <tr style="width: 100%;">
                        <td colspan="6" style="text-align: center;height: 35px;border: #cfcfcf solid 1px;">
                            <h3 id="title_top">京山市人民医院{{ year_num }}年度医德考评登记表</h3>
                        </td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 10%;text-align: center;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;letter-spacing: 5.5px;">
                            姓&nbsp;&nbsp;&nbsp;&nbsp;名
                        </td>
                        <td id="user_name" style="width: 23%;padding-left: 0.5%;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;">
                            {{ realname }}
                        </td>
                        <td style="width: 10%;text-align: center;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;letter-spacing: 5.5px;">
                            性&nbsp;&nbsp;&nbsp;&nbsp;别
                        </td>
                        <td style="width: 23%;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;">
                            <select name="gender" id="select_sex" style="padding-left: 0.5%;border: none;outline: none;width: 100%;height: 100%;">
                                <option value="">请选择性别</option>
                                <option value="male">男</option>
                                <option value="female">女</option>
                            </select>
                        </td>
                        <td style="width: 11%;text-align: center;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;letter-spacing: 5px;">出生年月</td>
                        <td style="width: 23%;padding-left: 0.5%;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;" class="jeinput_1">
                            <input id="birthday" type="text" style="width: 99%;height: 99%;border: none;outline: none;" placeholder="2000.01" onblur="FormatLimits(this)">
                        </td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 10%;text-align: center;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;letter-spacing: 5px;">政治面貌</td>
                        <td style="width: 23%;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;">
                            <select name="" id="zzmm" style="width: 100%;height: 100%;outline: none;border: none;">
                                <option value="">请选择政治面貌</option>
                                <option value="共青团员">共青团员</option>
                                <option value="中共党员">中共党员</option>
                                <option value="中共预备党员">中共预备党员</option>
                                <option value="无党派人士">无党派人士</option>
                                <option value="群众">群众</option>
                                <option value="其他">其他</option>
                            </select>
                        </td>
                        <td style="width: 10%;text-align: center;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;letter-spacing: 5px;">文化程度</td>
                        <td style="width: 23%;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;">
                            <select name="" id="whcd" style="width: 100%; height: 100%;outline: none;border: none;">
                                <option value="">请选择文化程度</option>
                                <option value="大专">大专及以下</option>
                                <option value="本科">本科</option>
                                <option value="硕士">硕士</option>
                                <option value="博士">博士</option>
                            </select>
                        </td>
                        <td style="width: 11%;text-align: center;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;letter-spacing: 5.5px;">职&nbsp;&nbsp;&nbsp;&nbsp;称</td>
                        <td style="width: 23%;padding-left: 0.5%;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;outline: none;" id="rank" contenteditable="true"></td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 10%;text-align: center;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;">参加工作时间</td>
                        <td style="width: 23%;padding-left: 0.5%;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;" class="jeinput_1">
                            <input id="pysj" type="text" style="width: 99%;height: 99%;border: none;outline: none;" placeholder="2020.01" onblur="FormatLimits(this)">
                        </td>
                        <td style="width: 10%;text-align: center;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;letter-spacing: 5px;">科&nbsp;&nbsp;&nbsp;&nbsp;室</td>
                        <td style="width: 23%;padding-left: 0.5%;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;outline: none;" id="work_is" onclick="show_office_model()"></td>
                        <td style="width: 11%;text-align: center;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;">参评科室/小组</td>
                        {% if team_flag == 'true' %}
                            <td style="width: 23%;padding-left: 0.5%;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;cursor: pointer;outline: none;">
                                <select name="" onchange="checked_dep()" id="select_depart" style="width: 100%;height: 100%;outline: none;border: none;">
                                    <option value="0">请选择参评小组</option>
                                    <option value="1001">医德医风评选一组</option>
                                    <option value="1002">医德医风评选二组</option>
                                    <option value="1003">医德医风评选三组</option>
                                    <option value="1004">医德医风评选四组</option>
                                </select>
                            </td>
                        {% else %}
                            <td id="select_depart" style="width: 23%;padding-left: 0.5%;height: 35px;line-height: 35px;border: #cfcfcf solid 1px;cursor: pointer;outline: none;" onclick="show_review_model()"></td>
                        {% endif %}
                    </tr>
                    <tr>
                        <td style="writing-mode: vertical-lr;width: 10%;height: 600px;border: #cfcfcf solid 1px;font-size: 18px;text-align:center;letter-spacing: 15px">
                            本年度医德医风自评及工作总结
                        </td>
                        <td colspan="5" id="work_text" style="width: 90%;height: 600px;padding-left: 0.5%;border: #cfcfcf solid 1px;outline: none;vertical-align: top;" onblur="quchu_style()" contenteditable="true">
                        </td>
                    </tr>
                </table>
                <table style="width: 100%;">
                    <tr style="width: 100%;">
                        <td style="width: 10%; text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;letter-spacing: 5px;">综合评价<p style="letter-spacing: 4px;">汇&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;总</p></td>
                        <td style="width: 11%; text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;">优秀</td>
                        <td style="width: 11%; text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                        <td style="width: 11%; text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;">良好</td>
                        <td style="width: 11%; text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                        <td style="width: 11%; text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;">一般</td>
                        <td style="width: 11%; text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                        <td style="width: 11%; text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;">较差</td>
                        <td style="width: 13%; text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                    </tr>
                    <tr style="width: 100%;">
                        <td colspan="2" style="width: 21%; text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;letter-spacing: 5px;font-size: 16px;"><strong>考评项目</strong></td>
                        <td style="width: 11%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;font-size: 16px;"><strong>基础得分</strong></td>
                        <td colspan="5" style="width: 55%; text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;font-size: 16px;"><strong>考评具体内容</strong></td>
                        <td style="width: 13%; text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;font-size: 16px;"><strong>科室评分</strong></td>
                    </tr>

                    <tr style="width: 100%;">
                        <td colspan="2" style="width: 21%; text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">
                            救死扶伤，全心全意为人民服务
                        </td>
                        <td style="width: 11%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;">10分</td>
                        <td colspan="5" style="width: 55%;text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">工作认真、负责、细致，责任心强</td>
                        <td style="width: 13%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                    </tr>
                    <tr style="width: 100%;">
                        <td colspan="2" rowspan="2" style="width: 21%; text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">
                            尊重病人的人格和权力，为病人保守秘密
                        </td>
                        <td rowspan="2" style="width: 11%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;">15分</td>
                        <td colspan="5" style="width: 55%;text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">平等对待患者，做到一视同仁，不得歧视患者（5分）</td>
                        <td style="width: 13%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                    </tr>
                    <tr>
                        <td colspan="5" style="width: 55%;text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">尊重患者知情权、选择权和隐私权，为患者保守医疗秘密（10分）</td>
                        <td style="width: 13%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                    </tr>
                    <tr style="width: 100%;">
                        <td colspan="2" rowspan="3" style="width: 21%; text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">
                            文明礼貌，优质服务，构建和谐医患关系
                        </td>
                        <td rowspan="3" style="width: 11%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;">15分</td>
                        <td colspan="5" style="width: 55%;text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">服务热情周到，态度和蔼可亲，无“生、冷、硬、顶、推、拖”现象（5分）</td>
                        <td style="width: 13%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                    </tr>
                    <tr>
                        <td colspan="5" style="width: 55%;text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">着装整洁，举止端庄，语言文明规范（5分）</td>
                        <td style="width: 13%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                    </tr>
                    <tr>
                        <td colspan="5" style="width: 55%;text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">认真践行医疗服务承诺，加强与患者的交流沟通，自觉接受监督，构建和谐医患关系（5分）</td>
                        <td style="width: 13%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                    </tr>
                    <tr style="width: 100%;">
                        <td colspan="2" rowspan="2" style="width: 21%; text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">
                            遵纪守法，廉洁行医
                        </td>
                        <td rowspan="2" style="width: 11%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;">20分</td>
                        <td colspan="5" style="width: 55%;text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">坚持廉洁行医，拒收患者或家属的红包等财物，自觉抵制回扣等各种形式商业贿赂，严格执行《医疗机构工作人员廉洁从业九项准则》规定（10分）</td>
                        <td style="width: 13%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                    </tr>
                    <tr>
                        <td colspan="5" style="width: 55%;text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">不开具虚假医学证明，不参与虚假医疗广告宣传和药品医疗器械促销，不隐匿、伪造或违反规定涂改、销毁医学文书及有关资料（10分）</td>
                        <td style="width: 13%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                    </tr>

                    <tr style="width: 100%;">
                        <td colspan="2" rowspan="3" style="width: 21%; text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">
                            因病施治，规范医疗服务行为
                        </td>
                        <td rowspan="3" style="width: 11%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;">20分</td>
                        <td colspan="5" style="width: 55%;text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">坚持合理检查、合理治疗、合理用药（5分）</td>
                        <td style="width: 13%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                    </tr>
                    <tr>
                        <td colspan="5" style="width: 55%;text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">认真落实有关控制医药费用的制度措施（5分）</td>
                        <td style="width: 13%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                    </tr>
                    <tr>
                        <td colspan="5" style="width: 55%;text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">严格执行医疗服务和药品价格政策，不多收、乱收和私自收取费用（10分）</td>
                        <td style="width: 13%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                    </tr>
                    <tr style="width: 100%;">
                        <td colspan="2" style="width: 21%; text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">
                            顾全大局，团结协作，和谐共事
                        </td>
                        <td style="width: 11%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;">10分</td>
                        <td colspan="5" style="width: 55%;text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">顾全大局，团结协作，和谐共事</td>
                        <td style="width: 13%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                    </tr>
                    <tr style="width: 100%;">
                        <td colspan="2" style="width: 21%; text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">
                            严谨求实，努力提高专业技术水平
                        </td>
                        <td style="width: 11%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;">10分</td>
                        <td colspan="5" style="width: 55%;text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;">严谨求实，努力提高专业技术水平</td>
                        <td style="width: 13%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                    </tr>
                    <tr style="width: 100%;">
                        <td colspan="8" style="width: 87%; text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;font-size: 16px;"><strong>考评得分</strong></td>
                        <td style="width: 13%;text-align: center;height: 35px;border: #cfcfcf solid 1px;border-top: none;"></td>
                    </tr>
                    <tr style="width: 100%;">
                        <td colspan="3" style="width: 33%;height: 350px;border: #cfcfcf solid 1px;border-top: none;font-size: 16px;vertical-align: top;">
                            <p style="width: 100%;height: 50px;line-height: 35px;padding-left: 1%;">科室（病区）意见：</p>
                            <p style="width: 100%;height: 150px;padding-left: 1%;line-height: 30px;padding-top: 50px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;经科室综合评价，同意<br>&nbsp;&nbsp;&nbsp;&nbsp;评为
                                <label for="" style="width: 100px;text-align: center;"></label> 等级。</p>
                            <p style="width: 100%;height: 100px;line-height: 35px;padding-left: 1%;">
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;负责人签名：
                                <img id="signature_img" src="/media/signature_picture/2022/05/a30d479e1dcfbcea3256b02f5b789dded58dee77.png" style="height: 60px;width: 150px;display: none;" alt="">
                            </p>
                            <p style="width: 100%;height: 50px;padding-right: 3%;text-align: right;letter-spacing: 15px;line-height: 50px;">年   月   日</p>
                        </td>
                        <td colspan="3" style="width: 33%;height: 350px;border: #cfcfcf solid 1px;border-top: none;font-size: 16px;vertical-align: top;">
                            <p style="width: 100%;height: 50px;line-height: 35px;padding-left: 1%;">被考核人意见：</p>
                            <p style="width: 100%;height: 150px;padding-left: 1%;line-height: 30px;padding-top: 50px;"></p>
                            <p style="width: 100%;height: 100px;line-height: 35px;padding-left: 1%;">
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;签名：
                                <img id="signature_img1" src="/media/signature_picture/2022/05/a30d479e1dcfbcea3256b02f5b789dded58dee77.png" style="height: 60px;width: 150px;display: none;" alt="">
                            </p>
                            <p style="width: 100%;height: 50px;padding-right: 3%;text-align: right;letter-spacing: 15px;line-height: 50px;">年   月   日</p>
                        </td>
                        <td colspan="3" style="width: 34%;height: 350px;border: #cfcfcf solid 1px;border-top: none;font-size: 16px;vertical-align: top;">
                            <p style="width: 100%;height: 50px;line-height: 35px;padding-left: 1%;">考评小组综合评价得分及意见：</p>
                            <p style="width: 100%;height: 150px;padding-left: 1%;line-height: 30px;padding-top: 50px;"></p>
                            <p style="width: 100%;height: 100px;line-height: 35px;padding-left: 1%;">
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;单位盖章：
                                <img id="signature_img1" src="/media/signature_picture/2022/05/a30d479e1dcfbcea3256b02f5b789dded58dee77.png" style="height: 60px;width: 150px;display: none;" alt="">
                            </p>
                            <p style="width: 100%;height: 50px;padding-right: 3%;text-align: right;letter-spacing: 15px;line-height: 50px;">年   月   日</p>
                        </td>
                    </tr>
                    <tr style="width: 100%;">
                        <td colspan="9" style="text-align: left;height: 35px;border: #cfcfcf solid 1px;border-top: none;padding-left: 1%;padding-right: 0.5%;color: red;font-size: 15px;">
                            <strong>注：1.优秀：90-100分；良好：80-89分；一般：60-79分；较差：60分以下。2.获得考评优秀的人数不超过各科室总人数的15%。</strong>
                        </td>
                    </tr>
                </table>
            </div>
        </div>

        <div style="width: 100%;height: 50px;position: absolute;text-align: center;bottom: 0;box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);">
            <div id="save_from" onclick="save_from()">
                保存
            </div>
            <div id="submit_from" onclick="DisplayConfirmation()">
                提交
            </div>
        </div>
    </div>

    <div id="selection-office" class="office-shade">
        <div id="office-model">
            <!-- 标题 -->
            <div id="office-title">
                <h5 style="line-height: 40px;width: 15%;margin-left: 1%;display: inline-block;font-size: 14px;">选择科室</h5>
                <span onclick="close_office_models()" style="float: right;line-height: 50px;padding-right: 2%;cursor: pointer;"><i class="iconfont icon-quchu"></i></span>
            </div>
            <hr>
            <div style="width: 55%;height: 350px;vertical-align: top;left: 0;display: inline-block;border-right: #cfcfcf solid 1px;">
                <div style="width: 100%;height: 50px;line-height: 50px;padding-left: 2%;">
                    <input id="search_data1" onkeydown="search_dep()" class="search-input" type="text" placeholder="搜索" autocomplete="off">
                </div>
                <div id="processed" style="width: 100%;height: 300px;overflow: auto;">
                    {% for company in company_list %}
                        <div style="width: 100%;height: 30px;line-height: 30px;font-size: 14px;color: #0b0b0b;">
                            <input class="check_box1" id="{{ company.id }}" type="checkbox" onclick="check_dep_ff('{{ company.name }}', '{{ company.id }}', false)"> {{ company.name }}
                        </div>
                    {% endfor %}
                </div>
            </div>

            <div style="width: 43%;height: 360px;vertical-align: top;left: 0;display: inline-block;">
                <div style="width: 100%;height: 50px;line-height: 50px;padding-left: 2%;font-size: 14px;">
                    已选择科室
                </div>
                <div id="processed_prople" style="width: 100%;height: 265px;overflow: auto;padding-left: 2%;">

                </div>
                <div style="width: 100%;height: 40px;text-align: center;">
                    <button onclick="summit_val()" style="border-radius: 2px;height: 30px;margin-top: 5px;border: #1E90FF solid 1px;background: #1E90FF;color: white;width: 80px;letter-spacing: 4px;font-size: 14px;">
                        提交
                    </button>
                    <button onclick="close_office_models()" style="border-radius: 2px;height: 30px;margin-top: 5px;border: #cfcfcf solid 1px;width: 80px;letter-spacing: 4px;margin-left: 15px;font-size: 14px;">
                        取消
                    </button>
                </div>
            </div>
        </div>
    </div>

    <div id="join-review-office" class="office-shade">
        <div id="review-model">
            <!-- 标题 -->
            <div id="review-title">
                <h5 style="line-height: 40px;width: 15%;margin-left: 1%;display: inline-block;font-size: 14px;">选择参评科室</h5>
                <span onclick="close_review_models()" style="float: right;line-height: 50px;padding-right: 2%;cursor: pointer;"><i class="iconfont icon-quchu"></i></span>
            </div>
            <hr>
            <div style="width: 55%;height: 350px;vertical-align: top;left: 0;display: inline-block;border-right: #cfcfcf solid 1px;">
                <div style="width: 100%;height: 50px;line-height: 50px;padding-left: 2%;">
                    <input id="search_data2" onkeydown="search_dep1()" class="search-input" type="text" placeholder="搜索" autocomplete="off">
                </div>
                <div id="processed1" style="width: 100%;height: 300px;overflow: auto;">
                    {% for team in team_list %}
                        <div style="width: 100%;height: 30px;line-height: 30px;font-size: 14px;color: #0b0b0b;">
                            <input class="check_box2" id="{{ team.id }}_1" type="checkbox" onclick="check_dep_ff1('{{ team.name }}', '{{ team.id }}_1', false)"> {{ team.name }}
                        </div>
                    {% endfor %}
                </div>
            </div>

            <div style="width: 43%;height: 360px;vertical-align: top;left: 0;display: inline-block;">
                <div style="width: 100%;height: 50px;line-height: 50px;padding-left: 2%;font-size: 14px;">
                    已选择科室
                </div>
                <div id="processed_prople_1" style="width: 100%;height: 265px;overflow: auto;padding-left: 2%;">

                </div>
                <div style="width: 100%;height: 40px;text-align: center;">
                    <button onclick="summit_val1()" style="border-radius: 2px;height: 30px;margin-top: 5px;border: #1E90FF solid 1px;background: #1E90FF;color: white;width: 80px;letter-spacing: 4px;font-size: 14px;">
                        提交
                    </button>
                    <button onclick="close_review_models()" style="border-radius: 2px;height: 30px;margin-top: 5px;border: #cfcfcf solid 1px;width: 80px;letter-spacing: 4px;margin-left: 15px;font-size: 14px;">
                        取消
                    </button>
                </div>
            </div>
        </div>
    </div>

    <div id="ConfirmSubmission" class="shade">
        <div id="ConfirmFirst" style="width: 100%;height: 100%;position: absolute;">
            <div id="ConfirmSecond" style="width: 350px;height: 150px;background: white;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
                <div style="width: 350px;height: 150px;">
                    <div style="width: 350px;height: 105px;line-height: 105px;text-align: center;">
                        <img src="../../static/medical_ethics/imgs/提醒.png" alt="" style="width: 40px;height: 40px;"> 是否确认提交流程？提交后将默认签名并视为同意考核结果！
                    </div>
                    <div style="width: 350px;height: 40px;text-align: center;">
                        <button id="cancellation" onclick="CloseConfirmation()">取&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;消</button>
                        <button id="acknowledge" onclick="submit_from()">确&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;认</button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div id="prompt" class="shade">
        <div style="width: 100%;height: 100%;position: absolute;">
            <div id="PromptFirst" style="width: 350px;height: 150px;background: white;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
                <div id="PromptSecond" style="display: flex;justify-content: space-between;box-sizing: border-box;padding: 0 10px;height: 40px;color: #0b0b0b;cursor: move;width: 100%;background: #f4f7fa;border-top-left-radius: 5px;border-top-right-radius: 5px;">
                    <h5 style="line-height: 40px;width: 15%;margin-left: 1%;display: inline-block;font-size: 14px;">提示</h5>
                    <span onclick="close_prompt_models()" style="float: right;line-height: 40px;padding-right: 2%;cursor: pointer;"><i class="iconfont icon-quchu"></i></span>
                </div>
                <hr>
                <div id="prompt_content" style="width: 350px;height: 105px;padding: 1%;">
                    <div id="prompt_one" style="display: none;">
                        医德医风评选一组包括：<br><strong>党委办公室</strong>、<strong>医院办公室</strong>、<strong>宣传科</strong>、<strong>外联部</strong>、<strong>工会办公室</strong>、<strong>人事科</strong>、<strong>医务科</strong>、<strong>科教科</strong>、<strong>护理部</strong>、<strong>院感办</strong>、<strong>公共卫生科</strong>、<strong>车队</strong>、<strong>质管办</strong>
                    </div>
                    <div id="prompt_two" style="display: none;">
                        医德医风评选二组包括：<br><strong>膳食委员会办公室</strong>、<strong>招标办</strong>、<strong>基建科</strong>、<strong>项目办</strong>、<strong>保卫科</strong>
                    </div>
                    <div id="prompt_three" style="display: none;">
                        医德医风评选三组包括：<br><strong>财务科</strong>、<strong>经管办</strong>、<strong>监察室</strong>、<strong>审计科</strong>
                    </div>
                    <div id="prompt_four" style="display: none;">
                        医德医风评选四组包括：<br><strong>门诊部</strong>、<strong>双向转诊办诊</strong>、<strong>临床营养科</strong>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div id="upload_signature" class="shade">
        <div style="width: 100%;height: 100%;position: absolute;">
            <div id="SignatureFirst" style="width: 350px;height: 150px;background: white;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
                <div id="SignatureSecond" style="display: flex;justify-content: space-between;box-sizing: border-box;padding: 0 10px;height: 40px;color: #0b0b0b;cursor: move;width: 100%;background: #f4f7fa;border-top-left-radius: 5px;border-top-right-radius: 5px;">
                    <h5 style="line-height: 40px;width: 15%;margin-left: 1%;display: inline-block;font-size: 14px;">提示</h5>
                    <span onclick="close_prompt_models1()" style="float: right;line-height: 40px;padding-right: 2%;cursor: pointer;"><i class="iconfont icon-quchu"></i></span>
                </div>
                <hr>
                <div id="prompt_content1" style="width: 350px;height: 105px;padding: 1%;">
                    您尚未上传个人签名，请前往【<a href="/that-center/MyBasicInformation.html">个人中心</a>】上传签名！
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block script %}
    <script type="text/javascript" src="../../static/public_file/js/DepartmentSelection.js"></script>
    <script>
        window.onload = function () {
            document.getElementById("personage").className = "add_class";
            document.getElementById("sponsor").className = "add_class";
        };

        function submit_from() {
            var team_flag = "{{ team_flag | safe }}";
            var form = new FormData();
            var gender = document.getElementById('select_sex').value;
            var birthday = document.getElementById("birthday").value;
            var zzmm = document.getElementById('zzmm').value;   // 政治面貌
            var whcd = document.getElementById('whcd').value;   // 文化程度
            var rank = document.getElementById("rank").innerText;       // 职称
            var pysj = document.getElementById("pysj").value;                //聘用时间
            var work_is = document.getElementById("work_is").innerText;             //从事工作
            if (team_flag === "true") {
                var Department_office = document.getElementById("select_depart").value;
            }else {
                Department_office = $("#select_depart").attr("name");
            }
            var work_text = document.getElementById("work_text").innerText;      // 自我评价
            var title = document.getElementById("title_top").innerText
            var year_num = {{ year_num }}
            if (!gender) {
                alert("请选择性别！")
                return false
            }
            if (!zzmm) {
                alert("请选择政治面貌！")
                return false
            }
            if (!whcd) {
                alert("请选择文化程度！")
                return false
            }
            if (!birthday){
                alert("请选择出生日期！")
                return false
            }
            if (!rank){
                alert("请输入职称！")
                return false
            }
            if (!pysj){
                alert("请填写入职时间！")
                return false
            }
            if(!work_is){
                alert("请输入从事工作！")
                return false
            }
            if(!Department_office){
                alert("参评科室不能为空！")
                return false
            }if(!work_text){
                alert("您需要填写自我评价与工作总结,以提高您的得分！")
                return false
            }
            form.append('gender', gender);
            form.append('birthday', birthday);
            form.append('zzmm', zzmm);
            form.append('whcd', whcd);
            form.append('rank', rank);
            form.append('pysj', pysj);
            form.append('work_is', work_is);
            form.append('Department_office', Department_office);
            form.append('work_text', work_text);
            form.append('title', title);
            form.append('year_num', year_num);
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;
            xhr.open('post', "/medical-ethics/medical_ethics_view", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        if (JsonDate['code'] === 200) {
                            alert("提交成功！");
                            window.location.href = "/medical-ethics/medical_ethics_my_apply_view";
                        } else {
                            alert(JsonDate['message'])
                        }

                    }
                }
            }
        }

        function summit_val() {
            var processed_prople = document.getElementsByClassName("selected-department");
            if (processed_prople.length === 0){
                alert("请选择科室！");
                return false
             }
            var dep_list=[];var product_company_list=[];
            for (var i=0; i<processed_prople.length; i++) {
                dep_list.push(processed_prople[i].innerText.split("(")[0])
                product_company_list.push(processed_prople[i].innerText.split("(")[1].replace(")", ''))
            }
            document.getElementById("work_is").innerText=dep_list.join();
            document.getElementById("work_is").setAttribute("name", product_company_list.join())
            close_office_models()
        }

        function summit_val1() {
            var processed_prople = document.getElementsByClassName("selected-department1");
            if (processed_prople.length === 0){
                alert("请选择参评科室！");
                return false
             }
            var dep_list=[];var product_company_list=[];
            for (var i=0; i<processed_prople.length; i++) {
                dep_list.push(processed_prople[i].innerText.split("(")[0])
                product_company_list.push(processed_prople[i].innerText.split("(")[1].replace(")", ''))
            }
            document.getElementById("select_depart").innerText=dep_list.join();
            document.getElementById("select_depart").setAttribute("name", product_company_list.join())
            close_review_models()
        }

        function search_dep() {
            var company_list = {{ company_list | safe }};
            var search_keyword = document.getElementById("search_data1").value;
            var processed = document.getElementById("processed");
            processed.innerHTML = "";
            for (var h=0; h<company_list.length; h++){
                if (company_list[h]["name"].indexOf(search_keyword) !== -1){
                    var div_tag = document.createElement("div");div_tag.className="div_clase";
                    div_tag.innerHTML = '<input class="check_box1" id="'+company_list[h]["id"]+'" type="checkbox" onclick="check_dep_ff(\''+company_list[h]["name"]+'\', \''+company_list[h]["id"]+'\', false)"> '+ company_list[h]["name"];
                    processed.appendChild(div_tag)
                }
            }
        }

        function search_dep1() {
            var company_list = {{ team_list | safe }};
            var search_keyword = document.getElementById("search_data2").value;
            var processed = document.getElementById("processed1");
            processed.innerHTML = "";
            for (var h=0; h<company_list.length; h++){
                if (company_list[h]["name"].indexOf(search_keyword) !== -1){
                    var div_tag = document.createElement("div");div_tag.className="div_clase";
                    div_tag.innerHTML = '<input class="check_box2" id="'+company_list[h]["id"]+'_1" type="checkbox" onclick="check_dep_ff1(\''+company_list[h]["name"]+'\', \''+company_list[h]["id"]+'_1\', false)"> '+ company_list[h]["name"];
                    processed.appendChild(div_tag)
                }
            }
        }
        
        function save_from() {
            var team_flag = "{{ team_flag | safe }}";
            var form = new FormData();
            var gender = document.getElementById('select_sex').value;
            var birthday = document.getElementById("birthday").value;
            var zzmm = document.getElementById('zzmm').value;   // 政治面貌
            var whcd = document.getElementById('whcd').value;   // 文化程度
            var rank = document.getElementById("rank").innerText;       // 职称
            var pysj = document.getElementById("pysj").value;                //聘用时间
            var work_is = document.getElementById("work_is").innerText;             //从事工作
            if (team_flag === "true") {
                var Department_office = document.getElementById("select_depart").value;
            }else {
                Department_office = $("#select_depart").attr("name");
            }
            var work_text = document.getElementById("work_text").innerText;      // 自我评价
            var title = document.getElementById("title_top").innerText
            var year_num = {{ year_num }};

            form.append('gender', gender);
            form.append('birthday', birthday);
            form.append('zzmm', zzmm);
            form.append('whcd', whcd);
            form.append('rank', rank);
            form.append('pysj', pysj);
            form.append('work_is', work_is);
            form.append('Department_office', Department_office);
            form.append('work_text', work_text);
            form.append('title', title);
            form.append('year_num', year_num);

            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;
            xhr.open('post', "/medical-ethics/SaveFrom", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        if (JsonDate['code'] === 200) {
                            alert("保存成功！");
                            window.location.href = "/medical-ethics/medical_ethics_my_apply_view";
                        } else {
                            alert(JsonDate['message'])
                        }

                    }
                }
            }
        }

        let ConfirmFirst = document.querySelector("#ConfirmFirst");
        let ConfirmSecond = document.querySelector("#ConfirmSecond");
        ConfirmFirst.addEventListener("mousedown", function (e) {
            let x = e.pageX - ConfirmSecond.offsetLeft;
            let y = e.pageY - ConfirmSecond.offsetTop;

            document.addEventListener("mousemove", move);
            function move(e) {
                ConfirmSecond.style.left = e.pageX - x + 'px';
                ConfirmSecond.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });
        
        function DisplayConfirmation() {
            var signature_flag = "{{ signature_flag | safe }}";
            if (signature_flag === "false") {
                show_prompt_model1();
                return false
            }
            document.getElementById("ConfirmSubmission").style.display = "table-row";
        }
        
        function CloseConfirmation() {
            document.getElementById("ConfirmSubmission").style.display = "none";
        }

        function FormatLimits(this_) {
            var dateRegex = /^\d{4}.\d{2}$/;

            // 获取用户输入的日期字符串
            var userInputDate = this_.value;

            if (!dateRegex.test(userInputDate)) {
                alert("请检查日期格式，按照表格示例填写！");
            }
        }

        function show_review_model() {
            document.getElementById("join-review-office").style.display="table-row";
        }

        function close_review_models() {
            document.getElementById("join-review-office").style.display = "none";
        }

        let review_title = document.querySelector("#review-title");
        let review_model = document.querySelector("#review-model");

        review_title.addEventListener("mousedown", function (e) {
            let x = e.pageX - review_model.offsetLeft;
            let y = e.pageY - review_model.offsetTop;

            document.addEventListener("mousemove", move);
            function move(e) {
                review_model.style.left = e.pageX - x + 'px';
                review_model.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        function check_dep_ff1(ele_name, ele_id, flag=true) {
            console.log("===================================", 'selected-'+ele_id+"-1")
            var html_str = `
                <div id="selected-`+ele_id+`-1" style="width: 95%;height: 30px;vertical-align: top;position: relative;background: #E8E8E8;margin-top: 8px;padding-left: 2%;line-height: 30px;">
                    <div id="close1" onclick="remove_dep1(`+ele_id.split("_")[0]+`)" style="width: 15px;height: 15px;background: #cfcfcf;border-radius: 50%;line-height: 14px;cursor: pointer;">
                        <i class="iconfont icon-quchu" style="font-size: 12px;color: white;margin-left: 1px;"></i>
                    </div>
                    <p class="selected-department1" style="height: 15px;margin-top: 0;font-size: 14px;">`+ele_name+'('+ele_id.split("_")[0]+')'+`</p>
                </div>
            `

            if (flag) {
                check_more_one_not1(ele_id);
                document.getElementById('processed_prople_1').innerHTML = '';
            }

            if (!document.getElementById(ele_id).checked){
                document.getElementById(ele_id).checked = false;
                document.getElementById('selected-'+ele_id+"-1").remove();
            }else {
                $("#processed_prople_1").append(html_str)
            }
        }

        function remove_dep1(obj_id) {
            console.log('selected-'+obj_id+"_1-1")
            document.getElementById('selected-'+obj_id+"_1-1").remove();
            document.getElementById(obj_id+"_1").checked = false;
        }

        let PromptSecond = document.querySelector("#PromptSecond");
        let PromptFirst = document.querySelector("#PromptFirst");

        PromptSecond.addEventListener("mousedown", function (e) {
            let x = e.pageX - PromptFirst.offsetLeft;
            let y = e.pageY - PromptFirst.offsetTop;

            document.addEventListener("mousemove", move);
            function move(e) {
                PromptFirst.style.left = e.pageX - x + 'px';
                PromptFirst.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        let SignatureSecond = document.querySelector("#SignatureSecond");
        let SignatureFirst = document.querySelector("#SignatureFirst");

        SignatureSecond.addEventListener("mousedown", function (e) {
            let x = e.pageX - SignatureFirst.offsetLeft;
            let y = e.pageY - SignatureFirst.offsetTop;

            document.addEventListener("mousemove", move);
            function move(e) {
                SignatureFirst.style.left = e.pageX - x + 'px';
                SignatureFirst.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        function show_prompt_model() {
            document.getElementById("prompt").style.display="table-row";
        }

        function close_prompt_models() {
            document.getElementById("prompt").style.display = "none";
        }

        function show_prompt_model1() {
            document.getElementById("upload_signature").style.display="table-row";
        }

        function close_prompt_models1() {
            document.getElementById("upload_signature").style.display = "none";
        }
        
        function checked_dep() {
            var checked_team = document.getElementById("select_depart").value;
            if (checked_team !== '0') {
                if (checked_team === "1001") {
                    document.getElementById("prompt_one").style.display = "block";
                    document.getElementById("prompt_two").style.display = "none";
                    document.getElementById("prompt_three").style.display = "none";
                    document.getElementById("prompt_four").style.display = "none";
                    show_prompt_model();
                }
                if (checked_team === "1002") {
                    document.getElementById("prompt_one").style.display = "none";
                    document.getElementById("prompt_two").style.display = "block";
                    document.getElementById("prompt_three").style.display = "none";
                    document.getElementById("prompt_four").style.display = "none";
                    show_prompt_model();
                }
                if (checked_team === "1003") {
                    document.getElementById("prompt_one").style.display = "none";
                    document.getElementById("prompt_two").style.display = "none";
                    document.getElementById("prompt_three").style.display = "block";
                    document.getElementById("prompt_four").style.display = "none";
                    show_prompt_model();
                }
                if (checked_team === "1004") {
                    document.getElementById("prompt_one").style.display = "none";
                    document.getElementById("prompt_two").style.display = "none";
                    document.getElementById("prompt_three").style.display = "none";
                    document.getElementById("prompt_four").style.display = "block";
                    show_prompt_model();
                }
            }
        }

        function quchu_style() {
            document.getElementById("work_text").style.fontFamily="宋体";
            document.getElementById("work_text").style.fontSize = "16px";
            // document.getElementById("work_text").innerText = document.getElementById("work_text").innerText;
        }
    </script>
{% endblock %}